﻿using System;

namespace MyDomain.Entity
{
    public class BaseEntity<TKey>
    {
        private int _isdelete;

        private DateTime _updatetime;

        private DateTime _createtimt;

        public TKey Id { get; set; }

        public DateTime CreateTime
        {
            get => _createtimt = DateTime.Now;
            set => UpDateTime = _createtimt;
        }

        /// <summary>
        /// 默认设置为当前时间
        /// </summary>
        public DateTime UpDateTime
        {
            get => _updatetime = DateTime.Now;
            set => UpDateTime = _updatetime;
        }

        /// <summary>
        /// 默认设置为0
        /// </summary>
        public int IsDelete
        {
            get => _isdelete != 0 ? _isdelete : 0;
            set => IsDelete = _isdelete;
        }
    }
}
